home *** CD-ROM | disk | FTP | other *** search
/ All for Cell Phones: Sony Ericsson / Sony-Ericsson 2004.iso / Java / DateCalc / datum.jar / StartForm.class (.txt) < prev   
Encoding:
Java Class File  |  2002-11-29  |  2.5 KB  |  57 lines

  1. import java.io.IOException;
  2. import javax.microedition.lcdui.Canvas;
  3. import javax.microedition.lcdui.Command;
  4. import javax.microedition.lcdui.CommandListener;
  5. import javax.microedition.lcdui.Displayable;
  6. import javax.microedition.lcdui.Font;
  7. import javax.microedition.lcdui.Graphics;
  8. import javax.microedition.lcdui.Image;
  9.  
  10. public class StartForm extends Canvas implements CommandListener {
  11.    Datum midlet;
  12.    Image logo;
  13.  
  14.    public StartForm(Datum midlet) {
  15.       this.midlet = midlet;
  16.       ((Displayable)this).setCommandListener(this);
  17.       Command selectLangCommand = new Command("Start", 1, 0);
  18.       Command selectInfoCommand = new Command("Info", 1, 0);
  19.       Command exitCommand = new Command("Schlie├ƒen", 1, 0);
  20.       ((Displayable)this).addCommand(selectLangCommand);
  21.       ((Displayable)this).addCommand(selectInfoCommand);
  22.       ((Displayable)this).addCommand(exitCommand);
  23.  
  24.       try {
  25.          this.logo = Image.createImage("/images/logo_max.png");
  26.       } catch (IOException var6) {
  27.       }
  28.  
  29.    }
  30.  
  31.    public void paint(Graphics g) {
  32.       g.setGrayScale(255);
  33.       g.fillRect(0, 0, ((Canvas)this).getWidth(), ((Canvas)this).getHeight());
  34.       g.setGrayScale(0);
  35.       g.drawImage(this.logo, 10, 0, 0);
  36.       g.setFont(Font.getFont(0, 0, 8));
  37.       g.drawString(this.midlet.appName, 10, 45, 0);
  38.       g.drawString("engelrico.de", 10, 55, 0);
  39.       g.drawString("(c) R. Engelmann", 10, 65, 0);
  40.    }
  41.  
  42.    public void commandAction(Command command, Displayable displayable) {
  43.       if (command.getLabel().equals("Schlie├ƒen")) {
  44.          this.midlet.destroyApp(true);
  45.       }
  46.  
  47.       if (command.getLabel().equals("Info")) {
  48.          this.midlet.viewInfoForm();
  49.       }
  50.  
  51.       if (command.getLabel().equals("Start")) {
  52.          this.midlet.viewInputForm();
  53.       }
  54.  
  55.    }
  56. }
  57.